package com.liu.spike.service.impl;

import com.liu.spike.service.KafkaProducerServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

/**
 * @className: com.liu.spike.service.impl.KafkaProducerServerImpl
 * @description: TODO
 * @author: liu
 * @create: 2022-05-02 14:26
 */

@Service
public class KafkaProducerServerImpl implements KafkaProducerServer {

    @Autowired
    private KafkaTemplate<String,String> kafkaTemplate;

    @Override
    public void sendToTopic(String topic, String msg) {
        kafkaTemplate.send(topic,msg);
    }
}
